const Router = require('koa-router');
const router = new Router();

router.post('/v1/test2/latest', (ctx, next) => {
  /*
    POST /v1/test2/latest HTTP/1.1
Host: localhost:3000
Content-Type: application/json
    {
      "a":1,
      "b":2
    }
  */
  console.log(ctx.request.body); // 没用bodyparser为undefined, 用了则为 { a: 1, b: 2 }
  console.log(ctx.request.body.a); // 1 bodyparser会将json自动解析为对象
  ctx.body = {
    key: 'test2'
  }
});

module.exports = router
